package com.crowntit.domain.trade.service.settlement.factory;

import com.crowntit.domain.trade.model.entity.GroupBuyOrderListEntity;
import com.crowntit.domain.trade.model.entity.TradeSettlementRuleBackEntity;
import com.crowntit.domain.trade.model.entity.TradeSettlementRuleCommandEntity;
import com.crowntit.domain.trade.service.settlement.filter.TradeSettlementScInterceptRuleFilter;
import com.crowntit.domain.trade.service.settlement.filter.TradeSettlementValidOutTradeNoRuleFilter;
import com.crowntit.domain.trade.service.settlement.filter.TradeSettlementValidTimeRuleFilter;
import com.crowntit.types.design.framework.link.model2.LinkArmory;
import com.crowntit.types.design.framework.link.model2.chain.BusinessLinkedLink;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

@Service
public class TradeSettlementRuleFilterFactory {

    @Bean("tradeSettlementRuleFilterLink")
    public BusinessLinkedLink<TradeSettlementRuleCommandEntity, DynamicContext, TradeSettlementRuleBackEntity> tradeSettlementRuleFilterLink(TradeSettlementScInterceptRuleFilter scInterceptRuleFilter, TradeSettlementValidOutTradeNoRuleFilter outTradeNoRuleFilter, TradeSettlementValidTimeRuleFilter validTimeRuleFilter){
        LinkArmory<TradeSettlementRuleCommandEntity, DynamicContext, TradeSettlementRuleBackEntity> linkArmory = new LinkArmory<>("tradeSettlementRuleFilterLink", scInterceptRuleFilter, outTradeNoRuleFilter, validTimeRuleFilter);
        return linkArmory.getLogicLink();
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class DynamicContext{
        private GroupBuyOrderListEntity groupBuyOrderList;
    }
}
